package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import com.itheima.pojo.ClazzQueryParam;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ClazzMapper {
//    List<Clazz> findAll();
   // @Insert("insert into clazz(name,room,begin_date,end_date,master_id,subject,create_time,update_time),values(#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void add(Clazz clazz);
    @Delete("delete from clazz where id=#{id}")
    void delete(Integer id);
    @Select("select * from clazz where name like concat('%',#{name},'%') and begin_date between #{begin} and #{end} limit #{page},#{pageSize}")
    List <Clazz> queryString(String name, LocalDate begin, LocalDate end, Integer pageN, Integer pageSize);

    List<Clazz> selectPage(ClazzQueryParam clazzQueryParam);
    @Select("select * from clazz where id=#{id}")
    Clazz findById(Integer id);



    void update(Clazz clazz);
    @Select("select * from clazz")
    List<Clazz> findAll();
//    @Select("select * from clazz")
//    List<Clazz> findAll();
}
